using System.Data;
using ET;
namespace DAL
{
    public class Transaction_DAL
    {
        private static readonly clsConnect cls = new clsConnect();
        #region Getdata
        public DataTable BindGirdtb_Transaction(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Transaction_Search");
        }
        public DataTable BindGirdtb_TransactionDetail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Transaction_ID", id);
            return cls.GetData("sp_tb_Transaction_Detail");
        }
        #endregion

        #region Insert
        public bool Inserttb_Transaction(Transaction_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Transaction_No", data.Transaction_No);
            cls.AddParameter("@Transaction_Date", data.Transaction_Date);
            cls.AddParameter("@Transaction_ID_Before", data.Transaction_ID_Before);
            cls.AddParameter("@Customer_ID", data.Customer_ID);
            cls.AddParameter("@Method_ID", data.Method_ID);
            cls.AddParameter("@Destination_ID", data.Destination_ID);
            cls.AddParameter("@Transaction_Content", data.Transaction_Content);
            cls.AddParameter("@Transaction_Result", data.Transaction_Result);
            cls.AddParameter("@Transaction_Note", data.Transaction_Note);
            cls.AddParameter("@Transaction_Available", data.Transaction_Available);
            cls.AddParameter("@Transaction_Available_Content", data.Transaction_Available_Content);
            cls.AddParameter("@Transaction_NotAvailable", data.Transaction_NotAvailable);
            cls.AddParameter("@Transaction_NotAvailable_Content", data.Transaction_NotAvailable_Content);
            cls.AddParameter("@Transaction_Contact_Again", data.Transaction_Contact_Again);
            cls.AddParameter("@Transaction_Contact_Again_Content", data.Transaction_Contact_Again_Content);
            cls.AddParameter("@Transaction_Schedule", data.Transaction_Schedule);
            cls.AddParameter("@Transaction_Schedule_ID", data.Transaction_Schedule_ID);
            cls.AddParameter("@Transaction_Potential", data.Transaction_Potential);
            cls.AddParameter("@Transaction_NotPotential", data.Transaction_NotPotential);
            cls.AddParameter("@Transaction_Unknown", data.Transaction_Unknown);
            cls.AddParameter("@Transaction_User_Add", data.Transaction_User_Add);
            cls.AddParameter("@Transaction_Date_Add", data.Transaction_Date_Add);
            cls.AddParameter("@Transaction_Computer_Add", data.Transaction_Computer_Add);
            return cls.ExecuteNonQuery("sp_tb_Transaction_Insert");
        }
        #endregion

        #region Update
        public bool Updatetb_Transaction(Transaction_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Transaction_ID", data.Transaction_ID);
            cls.AddParameter("@Transaction_No", data.Transaction_No);
            cls.AddParameter("@Transaction_Date", data.Transaction_Date);
            cls.AddParameter("@Transaction_ID_Before", data.Transaction_ID_Before);
            cls.AddParameter("@Customer_ID", data.Customer_ID);
            cls.AddParameter("@Method_ID", data.Method_ID);
            cls.AddParameter("@Destination_ID", data.Destination_ID);
            cls.AddParameter("@Transaction_Content", data.Transaction_Content);
            cls.AddParameter("@Transaction_Result", data.Transaction_Result);
            cls.AddParameter("@Transaction_Note", data.Transaction_Note);
            cls.AddParameter("@Transaction_Available", data.Transaction_Available);
            cls.AddParameter("@Transaction_Available_Content", data.Transaction_Available_Content);
            cls.AddParameter("@Transaction_NotAvailable", data.Transaction_NotAvailable);
            cls.AddParameter("@Transaction_NotAvailable_Content", data.Transaction_NotAvailable_Content);
            cls.AddParameter("@Transaction_Contact_Again", data.Transaction_Contact_Again);
            cls.AddParameter("@Transaction_Contact_Again_Content", data.Transaction_Contact_Again_Content);
            cls.AddParameter("@Transaction_Schedule", data.Transaction_Schedule);
            cls.AddParameter("@Transaction_Schedule_ID", data.Transaction_Schedule_ID);
            cls.AddParameter("@Transaction_Potential", data.Transaction_Potential);
            cls.AddParameter("@Transaction_NotPotential", data.Transaction_NotPotential);
            cls.AddParameter("@Transaction_Unknown", data.Transaction_Unknown);
            cls.AddParameter("@Transaction_User_Modify", data.Transaction_User_Modify);
            cls.AddParameter("@Transaction_Date_Modify", data.Transaction_Date_Modify);
            cls.AddParameter("@Transaction_Computer_Modify", data.Transaction_Computer_Modify);
            return cls.ExecuteNonQuery("sp_tb_Transaction_Update");
        }
        #endregion

        #region Delete
        public bool Deletetb_Transaction(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Transaction_ID", id);
            return true;
        }
        #endregion
    }
}